<template>
  <div class="chooseSettle">
    <!-- <el-button
      v-if="isTrue"
      plain
      type="single-number"
      style="margin-left: 15px"
      class="disabledBtn"
      disabled
      >选择</el-button
    > -->
    <el-button
      plain
      type="single-number"
      style="margin-left: 15px"
      @click="showContractList"
      >选择</el-button
    >
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      @closed="handleClose"
    >
      <el-alert :title="alertTitle" type="error" :closable="false"> </el-alert>
      <el-table
        :dataObj="singleSelectData"
        :data="purchaseListList"
        class="ccui-form-child-table"
        border
        width="600px"
        style="margin-bottom: 20px"
        max-height="800px"
      >
        <el-table-column
          show-overflow-tooltip
          label="序号"
          type="index"
          align="center"
        />

        <el-table-column
          show-overflow-tooltip
          prop="warehouseCode"
          label="仓库编号"
        >
        </el-table-column>

        <el-table-column
          show-overflow-tooltip
          prop="warehouseName"
          label="仓库名称"
        >
        </el-table-column>

        <el-table-column
          show-overflow-tooltip
          prop="warehousePlace"
          label="库存地点"
        >
        </el-table-column>

        <el-table-column
          show-overflow-tooltip
          prop="warehousePhone"
          label="联系电话"
        >
        </el-table-column>

        <el-table-column label="操作" width="127">
          <template slot-scope="{ row }">
            <el-button size="mini" type="text" @click="handlecheck(row)"
              >选择</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
// import { getSupplierData } from "@/basa/api";

import { listScWarehouse } from "@/app/inventoryManagement/components/api";

export default {
  props: {
    partyAId: {
      type: Number,
    },
    recordsTotal: {
      type: Number,
    },
    reportInOrgName: {
      type: String,
    },
    reportInOrgId: {
      type: Number,
    },
    isTrue: {
      type: Boolean,
    },
  },
  name: "warehouseDialog",
  data() {
    return {
      title: "选择仓库",
      alertTitle: "如需维护仓库信息，请去仓库维护功能菜单进行操作!",
      // 招标结果关联弹窗相关变量 start
      formDate: {
        warehouseCode: "",
        warehouseName: "",
        warehousePlace: "",
        warehousePhone: "",
        orgid: "",
        materialCode: "",
      },
      purchaseListList: [],
      singleSelectData: [],
      dialogVisible: false,
      // 招标结果关联弹窗相关变量 end
    };
  },
  watch: {},
  methods: {
    showContractList() {
      this.dialogVisible = true;
      this.getContractList();
    },
    getContractList() {
      listScWarehouse({
        // reportInOrgId: JSON.parse(window.sessionStorage.userDetal).orgId,
        reportInOrgId: this.reportInOrgId
      }).then((res) => {
        this.purchaseListList = res.data.data;
      });
    },
    //数据
    // getSupplierData() {
    //   getSupplierData(this.formDate).then(res => {
    //     this.singleSelectData = res.data.data.rows;
    //     this.singleSelectPageTotal = res.data.data.recordsTotal;
    //     console.log(this.singleSelectPageTotal);
    //   });
    // },
    handlecheck(row) {
      this.$emit("numrow", row);
      this.dialogVisible = false;
    },
    handleClose() {},
  },
};
</script>
<style lang="scss" scoped>
.chooseSettle {
  display: inline-block;
}
/deep/.el-single-select
  .el-dialog__wrapper
  .el-dialog
  .el-dialog__body
  .el-dialog-box
  .dialog-top {
  justify-content: space-between;
}
/deep/ .el-table__body-wrapper {
  max-height: 230px !important;
}
/deep/.label {
  display: inline-block;
  width: 130px !important;
  text-align: right;
}
/deep/ .el-dialog__footer {
  border-top: none;
}
/deep/ .el-table td,
.el-table th {
  padding: 5px 0 !important;
}
/deep/ .disabledBtn {
  // border: 1px solid #999 !important;
  span {
    color: #999 !important;
  }
}
</style>
